Skip to main content

Quick Start

Build your own medical agent by writing few lines of code.

Let's do step by step. Here is the breakdown:

Import and setup of necessary modules and classes

from Luci import Agent, SearchTool
import os # Import os to set environment variables

Under Luci modules, there are different classes and methods. To use luci, you need to import these according to your requirements.

User-defined parameters

query = ""  # Final Query
model = "" # Choose a model name
method = "call_together" # Choose a ChatModel method (corrected)
email = "use@mail.com" #use your email

You need to define these parameters for your agent. Remember before using any method, check the method list.

Set the API_KEY environment variable of the model

os.environ['API_KEY'] = ""

the API key should correspond to the chosen model (such as OpenAI, Azure OpenAI, or Together), we'll introduce logic that checks the method being used and sets the relevant API keys accordingly. Additionally, for Azure OpenAI, we'll need to set additional environment variables like API_VERSION and DEPLOYMENT_NAME.

Make a Research Agent

research_agent = Agent.built(
name="ResearchAgent",
objective="Gather the latest research on diabetes treatment guidelines.",
task=query, # The research task/query
precautions="Do not hallucinate information; only use reputable medical journals and sources.",
tool=SearchTool(email=email)
)

A research agent is built to search the latest topics based on pubmed and summarize the results in a well format.

Make a Writer Agent

writer = Agent.built(
name="WriterAgent",
objective="Compose a comprehensive summary based on the research findings.",
task="Summarize the diabetes treatment guidelines based on the provided research.",
precautions="Maintain medical accuracy and clarity.",
tool=None # No specific tool needed for writing
)

Based on the research! we need to prepare a writer agent which can meet your requirements.

Connect the Writer Agent to the Research Agent

research_agent.connect_agent('writer_agent', writer)

Generate the final answer using the connected Writer Agent

final_answer = research_agent.generate_final_answer(model, method, query)

print("Final Answer:")
print(final_answer)

This uses the Research Agent's task as the query for the Writer Agent and prints the result finally.